package com.bobo.web.provider.util.commutils;

import com.google.gson.*;

import java.lang.reflect.Type;

public class CharSequenceTypeAdapter implements JsonSerializer<CharSequence>, JsonDeserializer<CharSequence> {

	@Override
	public JsonElement serialize(CharSequence charSequence, Type type, JsonSerializationContext context) {
		return new JsonPrimitive(charSequence.toString());
	}
	
	@Override
	public CharSequence deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
		return jsonElement.getAsString();
	}

}
